//
//  Array+Extension.swift
//  VISUAL
//
//  Created by 刘森 on 2019/12/4.
//  Copyright © 2019 admin. All rights reserved.
//

import Foundation

extension Array {
    /**
     * 当safe为true 数组越界返回nil
     */
    subscript(index: Int, safe: Bool) -> Element? {
        if safe {
            if self.count > index {
                return self[index]
            }
            else {
                return nil
            }
        }
        else {
            return self[index]
        }
    }
    
}
